package toolkit

import (
	"path/filepath"
	"strings"
)

var officeSuffix = []string{".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx"}

// Allow 允许文件判断
func Allow(target string) bool {
	var ext = KeyFileExt(target)
	for _, t := range officeSuffix {
		if ext == t {
			return true
		}
	}
	return false
}

func KeyFileExt(key string) string {
	return filepath.Ext(strings.Split(key, "?")[0])
}
